// import express from "./express/index.js";
import express from "express";
import path from "path";
import ejs from "ejs";
const app = express();

// express  中的发布订阅
app.param("id", function (req, res, next, value, key) {
  console.log(value, key);
  //  对参数的中间件处理
  next();
});
app.param("id", function (req, res, next, value, key) {
  console.log(value, key);
  next();
});

app.param("name", function (req, res, next, value, key) {
  console.log(value, key);
  next();
});
// [fn1, fn2, fn3];

// next   ->  next   -> userFn
// {id:[fn1, fn2], name;[fn1]}  ->  userFn
// {id:[fn,fn]}
app.get("/:id/:name", function (req, res) {
  // this.keys = [id,name]
  res.send("ok");
});
app.listen(3000);

// session  -> express-session  / koa-session
// cookie -> cookie-parser / koa自带的
// static -> express.static / koa-static
// views -> express.engine / koa-views
// multer -> multer / koa-multer
// cors ->  cors / koa-cors
// roter -> 自带 / koa-router
// ...
